NHibernate 4.x Cookbook Second Edition by Liljas Gunnar & Zaytsev Alexander & Dentler Jason
Author:Liljas, Gunnar & Zaytsev, Alexander & Dentler, Jason
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2017-01-30T16:00:00+00:00
Run the application and start the QueryBySql recipe.
How it works…
We won't get into the details of the SQL queries.
Eager loading with LINQ
Often, when we query for some set of entities, we also want to load some of the related entities. In this recipe, we'll show you how we can use LINQ extensions to eager load the child collections of our query results.
Getting ready
Complete the Getting Ready section at the beginning of this chapter.
How to do it…
Create a new folder named EagerLoadingWithLinq in the project.
Add a new class named Recipe to the folder:using System.Linq; using NH4CookbookHelpers.Queries; using NH4CookbookHelpers.Queries.Model; using NHibernate; using NHibernate.Linq; namespace QueryRecipes.EagerLoadingWithLinq { public class Recipe : QueryRecipe { protected override void Run(ISession session) { var book = session.Query<Book>() .Fetch(x => x.Publisher) .FirstOrDefault(); Show("Book:", book); var movies = session.Query<Movie>() .FetchMany(x => x.Actors) .ToList(); Show("Movies:", movies); } } }
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7810)
Grails in Action by Glen Smith Peter Ledbrook(7720)
Azure Containers Explained by Wesley Haakman & Richard Hooper(6863)
Configuring Windows Server Hybrid Advanced Services Exam Ref AZ-801 by Chris Gill(6861)
Running Windows Containers on AWS by Marcio Morales(6389)
Kotlin in Action by Dmitry Jemerov(5092)
Microsoft 365 Identity and Services Exam Guide MS-100 by Aaron Guilmette(5081)
Combating Crime on the Dark Web by Nearchos Nearchou(4658)
Microsoft Cybersecurity Architect Exam Ref SC-100 by Dwayne Natwick(4642)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4438)
The Ruby Workshop by Akshat Paul Peter Philips Dániel Szabó and Cheyne Wallace(4346)
The Age of Surveillance Capitalism by Shoshana Zuboff(3985)
Python for Security and Networking - Third Edition by José Manuel Ortega(3903)
The Ultimate Docker Container Book by Schenker Gabriel N.;(3568)
Learn Wireshark by Lisa Bock(3553)
Learn Windows PowerShell in a Month of Lunches by Don Jones(3530)
Mastering Python for Networking and Security by José Manuel Ortega(3376)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3359)
Blockchain Basics by Daniel Drescher(3329)
